//
// Created by jsjxsy on 2022/8/31.
//
#include <iostream>
using namespace std;
class MyAdd {
 public:
  int operator()(int a, int b) {
    return a + b;
  }
};

class MyPrint {
 public:
  MyPrint() {
    count = 0;
  }
  void operator()(const string &str) {
    count++;
    cout << str << endl;
  }
  int count;

};

int main() {
  MyAdd myAdd;
  cout << myAdd(10, 20) << endl;
  //匿名函数对象
  cout << MyAdd()(10, 20) << endl;

  MyPrint myPrint;
  myPrint("java");
  myPrint("c++");
  cout << "My print count : " << myPrint.count << endl;
  return 0;
}
